package com.xzz.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author: hhz
 * @create: 2021-12-10 13:59
 **/
public class ManHandler implements InvocationHandler {
    private Man man;
    public ManHandler(Man man){
        this.man = man;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        before();
        method.invoke(man,null);
        after();
        return null;
    }
    private void before(){
        System.out.println("没有找到你之前，我是单身狗");
    }
    private void after(){
        System.out.println("找到你之后，满天星是你");
    }
}
